package com.zyf.chapter01.oo;

import java.io.IOException;
import java.util.logging.Level;

/**
 * 理论五
 *  抽象类特征
 * @author yifeng
 */
public class MessageQueueLogger extends Logger {

    private MessageQueueClient msgQueueClient;

    public MessageQueueLogger(String name,
                              boolean enabled,
                              Level minPermittedLevel,
                              MessageQueueClient msgQueueClient) {
        super(name, enabled, minPermittedLevel);
        this.msgQueueClient = msgQueueClient;
    }

    @Override
    protected void doLog(Level level, String message) throws IOException {
        // 格式化level 和 message，输出到消息中间件
        msgQueueClient.send();
    }

    class MessageQueueClient {
        public void send() {}
    }
}
